import java.util.Arrays;
import java.util.Comparator;

class student {
    int age;
    String name;

    public student(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public String toString() {
        return "student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
class nameComparetor implements Comparator<student>{
    @Override
    public int compare(student o1, student o2) {
        return o1.name.compareTo(o2.name);
    }
}
public class Main {
    public static void main(String[] args) {
        student[] student={
        new student(12,"xx"),
        new student(13,"xxx"),
        new student(11,"xx")};
        nameComparetor nameComparetor=new nameComparetor();
        Arrays.sort(student,nameComparetor);
        System.out.println(Arrays.toString(student));
    }
}